<%@page import="cn.sendto.model.ClassEntity"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.mapper.ClassMapper"%>
<%@page import="cn.sendto.mapper.IRowMapper"%>
<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%
   if(request.getSession().getAttribute("user")==null){
	   request.getRequestDispatcher("login.jsp").forward(request, response);
   }

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/main.css" />
</head>

<body class="add">
	<div class="add_div">
		<form action="add.jsp" method="post">
			<div class="add_item">
				<span>姓名：<input type="text"  name="studentname"/>
				</span>
			</div>
			<div class="add_item" >
				<span> 性别： <select name="gender">
						<option value="男">男</option>
						<option value="女">女</option>
				</select>
				</span>
			</div>
			<div class="add_item">
				<span>年龄：<input type="number"  name="age"/>
				</span>
			</div>
			<div class="add_item">
				<span>学号：<input type="text"  name="studentno"/>
				</span>
			</div>
			<div class="add_item">
				<span>地址：<input type="text"  name="address"/>
				</span>
			</div>
			<div class="add_item">
				<span>电话：<input type="text"  name="tel"/>
				</span>
			</div>
			<div class="add_item">
				<span> 班级： <select  name="classid">
				         <% 
				         DBHelper helper=new DBHelper();
				         IRowMapper classMapper=new ClassMapper();
						 final String CLASSQUERY="select * from classinfo";
						 List<ClassEntity> classList=helper.executeQuery(CLASSQUERY, classMapper, null);
						for(int i=0;i<classList.size();i++){
			    			out.print("<option value=\""+classList.get(i).getClassId()+"\">"+classList.get(i).getClassName()+"</option>");
			    		}
						helper.close();
				         %>
				</select>
				</span>
			</div>
			<div class="add_item">
				<span>密码：<input type="text"  name="password"/>
				</span>
			</div>
			<div class="btn">
				<input type="submit" value="提交" />
			</div>
		</form>
	</div>

</body>

</html>